import { reactive } from "vue";
import { defineStore } from 'pinia';

export const useRoleStore = defineStore('role', {
    state: () => ({
        // 当前选中的角色ID  
        selectedRoleNode: null,
        roleModel: reactive({
            id: '',
            roleName: '',
            addTime: null,
            addRoleId: '',
            editTime: null,
            editRoleId: ''
        }),
    }),
    actions: {
        // 更新当前选中的组织ID  
        setSelectedRoleNode(role) {
            this.selectedRoleNode = role;
        },
        resetRoleModel() {
            this.roleModel = {
                id: '',
                roleName: '',
                addTime: null,
                addRoleId: '',
                editTime: null,
                editRoleId: ''
            };
        }
    },
    getters: {
        // 获取当前选中角色的名称  
        selectedRoleName: () => {

        },
    },
});